//
//  ZZCTRUbiCell.m
//  ZZC-Finance
//
//  Created by mac on 2017/5/24.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "ZZCTRUbiCell.h"
#import "ZZCTRUbi.h"
#import "ZZCTRRefund.h"
#import "ZZCTRDue.h"
@implementation ZZCTRUbiCell

- (void)setTrubiModel:(ZZCTRUbi *)TrubiModel {
    _TrubiModel = TrubiModel;
    NSString *type;
    if([TrubiModel.trade_type integerValue] == 1) {
        type = @"充值";
    } else if ([TrubiModel.trade_type integerValue] == 2) {
        type = @"钱包交易";
    } else if ([TrubiModel.trade_type integerValue] == 3) {
        type = @"退款到钱包";
    } else if ([TrubiModel.trade_type integerValue] == 4) {
        type = @"提现";
    } else if ([TrubiModel.trade_type integerValue] == 5) {
        type = @"第三方直接交易";
    } else if ([TrubiModel.trade_type integerValue] == 6) {
        type = @"转定期";
    } else if ([TrubiModel.trade_type integerValue] == 7) {
        type = @"转活期";
    } else if ([TrubiModel.trade_type integerValue] == 8) {
        type = @"还款";
    }
    self.UbiTypeLabel.text = type;
    self.countLabel.text = [NSString stringWithFormat:@"%@",TrubiModel.money];
    self.beLeftLabel.text = [NSString stringWithFormat:@"%@",TrubiModel.remark];
    self.timeLabel.text = [NSString stringWithFormat:@"%@",TrubiModel.add_time];

}

-(void)setTrrefundModel:(ZZCTRRefund *)TrrefundModel {
    _TrrefundModel = TrrefundModel;
    self.UbiTypeLabel.text = @"还款";
    self.beLeftLabel.text = @"钱包";
    self.countLabel.text = [NSString stringWithFormat:@"%@",TrrefundModel.money];
    self.timeLabel.text = [NSString stringWithFormat:@"%@",TrrefundModel.repay_time];
    self.id = TrrefundModel.id;
}
-(void)setTrdueModel:(ZZCTRDue *)TrdueModel {
    _TrdueModel = TrdueModel;
    self.UbiTypeLabel.text = @"额度";
    self.countLabel.text = [NSString stringWithFormat:@"%@",TrdueModel.money];
    self.beLeftLabel.text = @"";
    self.timeLabel.text = [NSString stringWithFormat:@"%@",TrdueModel.pass_time];

}
// 改变滑动删除按钮样式
- (void)layoutSubviews {
    [super layoutSubviews];
    for (UIView *subView in self.subviews){
        if([subView isKindOfClass:NSClassFromString(@"UITableViewCellDeleteConfirmationView")]) {
            
            UIView *confirmView = (UIView *)[subView.subviews firstObject];
            // 改背景颜色
            confirmView.backgroundColor = [UIColor colorWithHex:0xff704a];
            
            for(UIView *sub in confirmView.subviews){
                if([sub isKindOfClass:NSClassFromString(@"UIButtonLabel")]){
                    UILabel *deleteLabel = (UILabel *)sub;
                    // 改删除按钮的字体
                    
                    deleteLabel.font = [UIFont boldSystemFontOfSize:15];
                    // 改删除按钮的文字
                    deleteLabel.text = @"删除";
                }
            }
            break;
        }
    }
}



@end
